package hn.sigit.model.hnd.administrative.dao;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.jboss.seam.Component;

import hn.sigit.model.hnd.administrative.HND_Request;
import hn.sigit.model.util.SigitDAO;

public class HND_RequestDAO extends SigitDAO<HND_Request> {
	private static final long serialVersionUID = 1L;

	public static HND_Request loadRequestByPresentationId(long presentationId) {
		Session commonsDatabase = (Session)Component.getInstance(COMMONS_DB);
		return loadRequestByPresentationId(commonsDatabase, presentationId);
	}


	public static HND_Request loadRequestByPresentationId(Session session, long presentationId) {
		Criteria criteria = session.createCriteria(HND_Request.class);
		criteria.add(Restrictions.eq("presentationId", presentationId));
		
		return (HND_Request)criteria.uniqueResult();
	}


}
